<template>
  <div class="container">
    <div>
      <h1 class="title">test sql api （nuxt-express）</h1>
      <div>
        <div class="links">
          <a href="/users" class="button--green">Users List</a>
        </div>
      </div>
      <div>{{ homeApi }}</div>
    </div>
  </div>
</template>

<script>
export default {
  async asyncData({ params, error, $http }) {
    const data = await $http.$get("/api");
    console.log("homeApi", data);
    return { homeApi: data };
  },
  computed: {},
  mounted() {
    this.getTestApi();
  },
  methods: {
    async getTestApi() {
      const data1 = await this.$http.$get("/api/listhome");
      console.log("testData", data1);

      const data2 = await this.$http.$get("/api/listhome/filter/data");
      console.log("testData2", data2);
      // let param = {
      //   limit: "15",
      //   offset:"1"
      // };
      // const data2 = await this.$http.$get("/api/getleckCourse", param);
      // console.log("testData2", data2);
    }
  },
  head() {
    return {
      title: "bnhcp"
    };
  }
};
</script>
<style lang="sass" scoped>
  .body
    background: #eee
    padding-top: 44px
    padding-bottom: 70px
  html 
    width: 100%
    height: 100%
    font-size: 62.5%
    color: #474747
  body 
    font-family: 'Microsoft YaHei', 'Hiragino Sans GB', 'Arail'
    padding-top: 44px
    padding-bottom: 6rem
    -webkit-box-sizing: border-box
    margin: 0
  body.gray 
    background: #eeeeee
  button,input,textarea 
    border: none
    -webkit-outline: none
    outline: none
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0)
    -webkit-appearance: none
    border-radius: 0
    padding: 0
  .fl 
    float: left
  .fr 
    float: right
  a 
    color: #474747
    text-decoration: none
  a:focus,a.active,a:hover 
    text-decoration: none

  ul,p,h1,h2,h3,h4,h5,h6 
    padding: 0
    margin: 0
  li 
    list-style: none

  em,i 
    font-style: normal

  img 
    vertical-align: middle
  .index-enter-active, .index-leave-active
    transition: opacity 0.2s
  .index-enter, .index-leave-active
    opacity: 0
</style>
